import {_ as e} from "./ContentWrap.vue_vue_type_script_setup_true_lang.6ff9ed7b1729265196717.js";
import {u as a, a as t, _ as l, b as s} from "./useCrudSchemas.2c3b314d1729265196717.js";
import {_ as o} from "./Dialog.vue_vue_type_style_index_0_lang.071fc2701729265196717.js";
import {s as r, m as n, g as i, d as u} from "./mobile.99207c401729265196717.js";
import {
    d as c,
    r as m,
    g as p,
    w as d,
    G as f,
    o as b,
    c as v,
    B as _,
    k as h,
    a as g,
    j as y,
    i as w,
    l as j,
    p as x,
    H as R,
    E as F,
    I as k,
    h as C,
    s as S
} from "./index.115af62d1729265196717.js";
import {E} from "./el-button.c1876bd01729265196717.js";
import {u as P, F as I} from "./useForm.9355f9ab1729265196717.js";
import {E as L} from "./el-divider.111259cd1729265196717.js";
import "./tree.67a6f3e21729265196717.js";
import "./mitt.f0e547641729265196717.js";
import "./index.eec34c841729265196717.js";
import "./el-form-item.eb8d765c1729265196717.js";
import "./_plugin-vue_export-helper.1b428a4d1729265196717.js";

const O = {style: {"text-align": "center"}}, A = c({
    __name: "NewMobile",
    props: {currentRow: {type: Object, default: () => null}, actionType: {type: String, default: () => null}},
    emits: ["success"],
    setup(e, {expose: a, emit: t}) {
        const l = e;
        m(!1);
        const s = m(), o = m(), i = m(!1);
        m();
        const u = async () => {
            C.getFormData().then((async e => {
                if (i.value = !0, s.value = r, o.value = n, "" === l.actionType) if (s.value) {
                    await s.value(e).catch((e => {
                        F.error(e.msg ? e.msg : "保存失败!")
                    })).finally((() => {
                        i.value = !1
                    })) && (F.success("保存成功!"), t("success"))
                } else F.info("请重新进入页面!"); else if (o.value) {
                    await o.value(e).catch((e => {
                        F.error(e.msg ? e.msg : "编辑失败!")
                    })).finally((() => {
                        i.value = !1
                    })) && (F.success("编辑成功!"), t("success"))
                } else F.info("请重新进入页面!")
            }))
        }, c = p([{field: "mobile_area", label: "区域", component: "Input", colProps: {span: 22}}, {
            field: "mobile",
            label: "手机号",
            component: "Input",
            colProps: {span: 22}
        }, {field: "mobile_area_en", label: "归属地", component: "Input", colProps: {span: 22}}, {
            field: "card_no",
            label: "卡号",
            component: "Input",
            colProps: {span: 22}
        }]), {register: k, methods: C, elFormRef: S} = P({schema: c});
        return d((() => l.currentRow), (e => {
            if (!e) return;
            const {setValues: a} = C;
            a(e)
        }), {deep: !0, immediate: !0}), a({elFormRef: S, getFormData: C.getFormData}), (e, a) => {
            const t = f("loading");
            return b(), v(R, null, [_(h(g(I), {
                style: {"padding-bottom": "60px"},
                onRegister: g(k)
            }, null, 8, ["onRegister"]), [[t, i.value]]), y("div", {
                style: {
                    position: "absolute",
                    right: "0%",
                    bottom: "0%",
                    width: "100%",
                    "z-index": "100",
                    opacity: "1"
                },
                class: x(["bg-[var(--el-color-white)] dark:bg-[var(--el-bg-color)] dark:border-[var(--el-border-color)]"])
            }, [h(g(L), {style: {margin: "0 0 15px"}}), y("div", O, [h(g(E), {
                type: "primary",
                onClick: u
            }, {default: w((() => [j("保存")])), _: 1})])], 2)], 64)
        }
    }
}), D = c({
    __name: "MobileList", setup(r) {
        const {register: n, tableObject: c, methods: d} = a({getListApi: i, delListApi: u, response: {list: "data"}}),
            f = m(!1), _ = m(!1), y = m(""), x = m(""), {getList: F, setSearchParams: P, setExportFile: I} = d, L = m(),
            O = m(!1);
        F();
        const D = () => {
            y.value = "新增", c.currentRow = null, _.value = !0, x.value = ""
        }, T = () => {
            _.value = !1, F()
        }, V = () => {
            d.setAppendParams({channel_id: "", name: ""}), c.currentPage = 1
        }, M = p([{field: "index", label: "序号", type: "index"}, {
            field: "mobile_area_en",
            label: "归属地",
            search: {show: !1}
        }, {field: "mobile_area", label: "区域", search: {show: !0}}, {
            field: "mobile",
            label: "号码",
            search: {show: !0}
        }, {field: "card_no", label: "卡号", search: {show: !0}}, {
            field: "created_at",
            label: "创建时间",
            search: {show: !1}
        }, {field: "operate", isCustom: !1, width: "200px", label: "操作"}]), {allSchemas: U} = t(M);
        return (a, t) => (b(), v(R, null, [h(g(e), null, {
            default: w((() => [h(g(l), {
                schema: g(U).searchSchema,
                showExportFile: O.value,
                onSearch: g(P),
                onReset: V,
                onCreated: D,
                onExportFile: g(I)
            }, null, 8, ["schema", "showExportFile", "onSearch", "onExportFile"])])), _: 1
        }), h(g(e), null, {
            default: w((() => [h(g(s), {
                tableObject: g(c),
                "onUpdate:tableObject": t[0] || (t[0] = e => k(c) ? c.value = e : null),
                columns: g(U).tableColumns,
                data: g(c).tableList,
                selection: !1,
                align: "center",
                reserveIndex: !0,
                border: "",
                headerAlign: "center",
                pagination: {total: g(c).total},
                onRegister: g(n)
            }, {
                operate: w((({row: e}) => [h(g(E), {
                    type: "primary", plain: "", onClick: a => ((e, a) => {
                        y.value = "edit" === a ? "编辑" : "新增", x.value = a, c.currentRow = e, _.value = !0
                    })(e, "edit")
                }, {default: w((() => [j("编辑")])), _: 2}, 1032, ["onClick"]), h(g(E), {
                    type: "danger",
                    onClick: a => (async (e, a) => {
                        var t;
                        c.currentRow = e;
                        const {delList: l, getSelections: s} = d;
                        f.value = !0, await l(null == (t = c.currentRow) ? void 0 : t.id).finally((() => {
                            f.value = !1
                        }))
                    })(e)
                }, {default: w((() => [j("删除")])), _: 2}, 1032, ["onClick"])])), _: 1
            }, 8, ["tableObject", "columns", "data", "pagination", "onRegister"])])), _: 1
        }), h(g(o), {
            modelValue: _.value,
            "onUpdate:modelValue": t[1] || (t[1] = e => _.value = e),
            title: y.value
        }, {
            default: w((() => ["detail" !== x.value ? (b(), C(A, {
                key: 0,
                ref_key: "writeRef",
                ref: L,
                "form-schema": g(U).formSchema,
                "current-row": g(c).currentRow,
                actionType: x.value,
                onSuccess: T
            }, null, 8, ["form-schema", "current-row", "actionType"])) : S("", !0)])), _: 1
        }, 8, ["modelValue", "title"])], 64))
    }
});
export {D as default};
